package com.sos.core.game
{

	import com.sos.core.cards.ActionCard;
	import com.sos.core.cards.CardKind;

	public class GameActionCard extends ActionCard
	{
	
		// -------------------------------------------------------------------------------
		// CONSTANTS
		// -------------------------------------------------------------------------------
		
		public static const 		JSON_PROPERTY_VALID_TARGETS:String		= "validTargets";
		
		// -------------------------------------------------------------------------------
		// FIELDS
		// -------------------------------------------------------------------------------
		
		protected var _validTargets:Vector.<GameTarget>;
		
		// -------------------------------------------------------------------------------
		// CONSTRUCTOR
		// -------------------------------------------------------------------------------
		
		public function GameActionCard()
		{
			// Ancestor constructor
			super(CardKind.GAME_INSTANCE);
			// init objects
			_validTargets = new Vector.<GameTarget>();
		}
		
		// -------------------------------------------------------------------------------
		// PROPERTIES
		// -------------------------------------------------------------------------------
		
		public function get validTargets():Vector.<GameTarget> 
		{
			return _validTargets;
		}
		
		public function set validTargets(value:Vector.<GameTarget>):void 
		{
			_validTargets = value;
		}
		
		// -------------------------------------------------------------------------------
		// PRIVATE METHODS
		// -------------------------------------------------------------------------------
		
		// -------------------------------------------------------------------------------
		// PUBLIC METHODS
		// -------------------------------------------------------------------------------
		
		public function addTarget(target:GameTarget):void {
			_validTargets.push(target);
		}
		
		
		override public function clear():void
		{
			// Call ancestor clear 
			super.clear();
			// Clear objects
			if (_validTargets)
				_validTargets.splice(0, _validTargets.length);
			
		}
	}
	
}